﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Text;
using System.Threading.Tasks;
using client.EvalServiceReference;

namespace client
{
    class Program
    {
         static void Main(string[] args)
        {

            
             /*  ///soap configuration 
                       ChannelFactory<IEvalServiceChannel> cf =
               new ChannelFactory<IEvalServiceChannel>("BasicHttpBinding_IEvalService");

           IEvalServiceChannel channel = cf.CreateChannel();
            Eval eval = new Eval();

            eval.Submitter = "jheorge";
            eval.TimeSent = DateTime.Now;
            eval.Comments = "i like this....";


            channel.SubmitEval(eval);
            channel.SubmitEval(eval);
            Eval [] evals=channel.GetEval();

            Console.WriteLine("how much amount of eval's there : {0}",evals.Length);
            Console.ReadLine();

            channel.Close();

              
             */

             Console.WriteLine("Evaluation client application with restfull \n");

             EvalServiceClient client = new EvalServiceClient("BasicHttpBinding_IEvalService");

             Console.WriteLine("pls enter a command :");
             string command = Console.ReadLine();


             while (!command.Equals("exit"))
             {
                 switch (command)
                 {
                     case "submit":
                    
                        Console.WriteLine("pls enter your name: ");
                        string name = Console.ReadLine();
                        Console.WriteLine("pls enter your comments: ");
                        string comments = Console.ReadLine();

                         Eval eval = new Eval();
                         eval.TimeSent = DateTime.Now;
                         eval.Submitter = name;
                         eval.Comments = comments;
                         client.SubmitEval(eval);
                         Console.WriteLine("submit successful \n");
                         break;


                     default:
                         Console.WriteLine("Unsupported command:");
                         break;


                 }

                 Console.WriteLine("pls enter a command :");
                 string command1 = Console.ReadLine();

             }
        }
    }
}
